home *** CD-ROM | disk | FTP | other *** search
- var pState;
- var pX;
- var pY;
- var pNum;
- var pObjList = new Array("screw","fuse","nozzle","nut","spring");
- this.testRect = function(tx, ty)
- {
- if(tx >= pRect[0] && tx <= pRect[2])
- {
- if(tY >= pRect[1] && ty <= pRect[3])
- {
- this._parent.camera_mc.setTarget(pY);
- return pY;
- }
- }
- };
- this.setPos = function(ty)
- {
- this._x = pX + 38;
- this._y = pY - ty;
- };
- this.activate = function()
- {
- var _loc1_ = this;
- var _loc3_ = pObjList.length;
- if(_loc3_ == 0)
- {
- _loc1_._parent.gameOver("win");
- }
- else
- {
- var _loc2_ = Math.floor(Math.random() * _loc3_);
- _loc1_.pObj = pObjList[_loc2_];
- _loc1_.pObjList.splice(_loc2_,1);
- switch(pObj)
- {
- case "screw":
- _loc1_.setUp(4,4);
- break;
- case "fuse":
- _loc1_.setUp(4,64);
- break;
- case "nozzle":
- _loc1_.setUp(34,61);
- break;
- case "nut":
- _loc1_.setUp(35,96);
- break;
- case "spring":
- _loc1_.setUp(24,115);
- }
- _loc1_._parent.top_mc.find_mc.gotoAndStop(pObj);
- _loc1_._parent.top_mc.findtxt_mc.gotoAndStop("find");
- _loc1_.pState = "active";
- _loc1_.gotoAndStop(_loc1_.pObj);
- }
- };
- this.collect = function()
- {
- var _loc1_ = this;
- _loc1_.pState = "collected";
- _loc1_._parent.snd_mc.playsound("pFind");
- _loc1_._parent.top_mc.addScore(10000);
- _loc1_.pX = -1000;
- switch(pObj)
- {
- case "screw":
- _loc1_._parent.target0_mc.activate();
- _loc1_._parent.bod_mc.setTarget(0);
- break;
- case "fuse":
- _loc1_._parent.target1_mc.activate();
- _loc1_._parent.bod_mc.setTarget(1);
- break;
- case "nozzle":
- _loc1_._parent.target2_mc.activate();
- _loc1_._parent.bod_mc.setTarget(2);
- break;
- case "nut":
- _loc1_._parent.target3_mc.activate();
- _loc1_._parent.bod_mc.setTarget(3);
- break;
- case "spring":
- _loc1_._parent.target4_mc.activate();
- _loc1_._parent.bod_mc.setTarget(4);
- }
- _loc1_._parent.top_mc.findtxt_mc.gotoAndStop("fix");
- _loc1_.gotoAndStop(2);
- };
- this.setUp = function(x, y)
- {
- this.pX = x * 16;
- this.pY = y * 16;
- };
- this.activate();
- stop();
-